<!DOCTYPE html>

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="/socket.io/socket.io.js"></script>
	<script type="text/javascript">
		var socket = io.connect();
		function setNickName() {
			socket.emit('set nickname', document.getElementById('nickname').value);
		}

		function getNickName() {
			socket.emit('get nickname');
		}

		socket.on('send nickname', function(data) {
			console.log('my nickname: ' + data);
		});

		socket.on('err', function(data) {
			console.log('server error: ' + data);
		})
 
	</script>
</head>
<body>
	nickname:
	<input type="text" id="nickname">
	<input type="button" onclick="setNickName()" value="setNickName">
	<input type="button" onclick="getNickName()" value="getNickName">
</body>
</html>